
@inject('pictureService','App\Interfaces\PictureService')
@inject('activityService','App\Interfaces\ActivityService')
@inject('goodsService','App\Interfaces\GoodsService')
@inject('shopService','App\Interfaces\ShopService')
@inject('userCollectionService','App\Interfaces\UserCollectionService')

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>专题-{{$SEO['title']}}</title>
    <meta name="keywords" content="{{$SEO['keywords']}}"/>
    <meta name="description" content="{{$SEO['description']}}"/>

    <!--公用css引用-->
    @include('front.common.style')
            <!--END/公用css引用-->
    <link rel="stylesheet" href="../dist/css/index.css">
    <?php

    $bg_img='../images/zt/zt-bg-1.jpg';
    $bg_color='0a052d';
    $bg_margin_top='500';

    if($activity->bg_img) $bg_img=$pictureService::thumb($activity->bg_img);
    if($activity->bg_color) $bg_color=$activity->bg_color;
    if($activity->bg_margin_top) $bg_margin_top=$activity->bg_margin_top;

    $tit_img='../images/zt/zt-tit-bg.png';
    $tit_width='1050';
    $tit_height='37';
    $tit_line_height='37';
    $tit_position='center';
    $tit_font_color='fff';
    $tit_font_size='28';

    if($activity->tit_img) $tit_img=$pictureService::thumb($activity->tit_img);
    if($activity->tit_width) $tit_width=$activity->tit_width;
    if($activity->tit_height) $tit_height=$activity->tit_height;
    if($activity->tit_line_height) $tit_line_height=$activity->tit_line_height;
    if($activity->tit_position) $tit_position=$activity->tit_position;
    if($activity->tit_font_color) $tit_font_color=$activity->tit_font_color;
    if($activity->tit_font_size) $tit_font_size=$activity->tit_font_size;

    $sidebar_bg_color='d53650';
    $sidebar_hover_color='bc2a68';
    $sidebar_top='470';
    $sidebar_left='540';
    $sidebar_line_height='18';
    $sidebar_font_size='14';
    $sidebar_font_color='fff';

    if($activity->sidebar_bg_color) $sidebar_bg_color=$activity->sidebar_bg_color;
    if($activity->sidebar_hover_color) $sidebar_hover_color=$activity->sidebar_hover_color;
    if($activity->sidebar_top) $sidebar_top=$activity->sidebar_top;
    if($activity->sidebar_left) $sidebar_left=$activity->sidebar_left;
    if($activity->sidebar_line_height) $sidebar_line_height=$activity->sidebar_line_height;
    if($activity->sidebar_font_size) $sidebar_font_size=$activity->sidebar_font_size;
    if($activity->sidebar_font_color) $sidebar_font_color=$activity->sidebar_font_color;

    ?>
    <style>

        .zt-bg-1{ background: url("{{$bg_img}}") no-repeat center top {{'#'.$bg_color}};padding-top: {{$bg_margin_top}}px;padding-bottom:40px;margin-bottom: -30px;}
        .list-title{ background: url("{{$tit_img}}") no-repeat center transparent;width:{{$tit_width}}px;height: {{$tit_height}}px;line-height: {{$tit_line_height}}px;font-size: {{$tit_font_size}}px;color:{{'#'.$tit_font_color}};}

        .right-bar2 { margin-left: {{$sidebar_left}}px;width: 70px;top: {{$sidebar_top}}px;text-align: center;}
        .right-bar2 li a{background-color: {{'#'.$sidebar_bg_color}}; color:{{'#'.$sidebar_font_color}};line-height: {{$sidebar_line_height}}px; font-size: {{$sidebar_font_size}}px; }
        .right-bar2 li:hover a{background-color:{{'#'.$sidebar_hover_color}}; color:{{'#'.$sidebar_font_color}}; }
    </style>
</head>
<body>

<!--公共头部-->

@include('front.common.header')
        <!--END/公共头部-->

        <!--基本护肤-->
<div class="zt-bg-1 fn-rel">

    <div class="inbox fn-rel" style="overflow: visible;">

        @foreach ($activityService->getActivityCat($id) as $k=>$activityCat )


            <div id="floor-{{$activityCat->id}}" class="list-title fn-tc fn-mb12 fn-mt30">
                <strong>{{$activityCat->cat_name}}</strong>
            </div>

            <div class="list-body">
                <ul class="imglist-2 ui-cols-4 imglist-2-ver imglist-skin-2">

                    @foreach ($activityService->getActivityGoods($activityCat->id) as $key=>$activityGoods)
                        @if($activityGoods->is_on_sale ==1)
                            <?php
                            $goods = $goodsService->get($activityGoods->goods_id);
                            if($goods){
                            $shop= $shopService->get($goods->shop_id);
                            $goodsInCollection=isset($user)?$userCollectionService->isInCollection($user->id,'GOODS',$goods->goods_id):false;
                            ?>
                            <li class="col col-space">
                                <div class="col-box">
                                    <div class="col-l">
                                        <a href="/goods/{{$goods->goods_id}}" title="{{$goods->goods_name}}">
                                            <img class="lazy img-lazyload" data-src="{{$pictureService::thumb($goods->goods_thumb,254,254)}}" alt="{{$goods->goods_name}}">
                                        </a>

                                        @if($goods->goods_number==0)
                                            <i class="icon icon-soldout"></i>
                                        @endif
                                    </div>
                                    <div class="col-r">
                                        <div class="panel-body">
                                            @if($goodsInCollection)
                                                <a href="javascript:;" class="fav-link fav"><i class="icon icon-fav"></i>已收藏</a>
                                            @else
                                                <a href="javascript:;" class="J-add-collection fav-link" reference_id="{{$goods->goods_id}}" collection-type="GOODS"><i class="icon icon-noFav"></i>收藏</a>
                                            @endif

                                            <p>
                                                <span class="text-color-1 font-14 fn-mr4">￥<span class="font-24">{{$goods->shop_price}}</span></span>
                                                @if($goods->shop_price>=60)
                                                    <span class="bl-label label-brd-red fn-mb8">包邮</span>
                                                @endif
                                                <del class="fn-fr font-14 fn-mt6 fn-hide">￥{{$goods->market_price}}</del>
                                            </p>
                                            <a class="tit link fn-dib-otw ui-100" href="/goods/{{$goods->goods_id}}" target="_blank" title="{{$goods->goods_name}}">{{$goods->goods_name}}</a>
                                            <p class="sub-tit fn-dib-otw" title="{{$goods->goods_pet_name}}">{{$goods->goods_pet_name}}&nbsp;</p>
                                            <p>
                                                @if($shop->shop_name=='阿福易购')
                                                    <a href="/shop/{{$goods->shop_id}}" target="_blank">{{$shop->shop_name}}</a><span class="bl-label fn-ml4">自营</span>
                                                @else
                                                    <a href="/shop/{{$goods->shop_id}}" target="_blank">{{$shop->shop_name}}旗舰店</a>
                                                @endif
                                            </p>
                                            <a href="javascript:;" data-id="{{$goods->goods_id}}" class="J-add-cart cart-link" title="加入购物车"><i class="icon icon-cart1"></i></a>

                                        </div>
                                    </div>
                                </div>
                            </li>
                            <?php }?>
                        @endif
                    @endforeach

                </ul>
            </div>
        @endforeach


    </div>

    <!--右侧浮动导航-->
    <div id="rightBar" class="right-bar2">
        <ul>


            @foreach ($activityService->getActivityCat($id) as $k=>$activityCat )

                <li>
                    <a class="js-floor" href="#floor-{{$activityCat->id}}">
                        <p class="text">{{$activityCat->cat_name}}</p>
                        <span class="borb"></span>
                    </a>
                </li>
            @endforeach

            <li class="go-top">
                <a href="#" title="返回顶部">
                    <i class="icon icon-bar-13"></i>
                </a>
            </li>
        </ul>
    </div>
    <!--END/右侧浮动导航-->

</div>
<!--END/基本护肤-->


<!--公共尾部-->
@include('front.common.footer')
        <!--END/公共尾部-->


<!--公用js引用-->
@include('front.common.script')
        <!--END/公用js引用-->

<script>
    //右侧浮动导航
    //这里不要写太多事件
    var  hNav=$('#hNav');
    var  rightBar=$('#rightBar');

    $(window).on('scroll',function(){
        var scrollTop=$(document).scrollTop();

        if(scrollTop>=130){
            hNav.addClass('h-nav-fix');
        }else{
            hNav.removeClass('h-nav-fix');

        }

        if(scrollTop>=304){
            rightBar.addClass('fix-bar');
        }else{
            rightBar.removeClass('fix-bar');
        }

    });

    //跳转到指定楼层
    rightBar.on('click','.js-floor',function(){
        var id=$(this).attr('href'),
                curFloor=$(id),
                offset,scrollTop;

        if(curFloor.length==0) return;

        offset=curFloor.offset();

        //向上微调20像素 显示效果更好
        scrollTop=offset.top-40;

        //顶部导航未浮动时，滚动到浮动高减少44
        if(hNav.length && !hNav.hasClass('h-nav-fix')){
            scrollTop -= 44;
        }


        tools.goToY(scrollTop, 500, function(){});

        return false;
    }).on('click','.js-goTop',function(){
        tools.goToY(0, 500, function(){});
        return false;
    });

</script>
</body>
</html>